import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/blade-user/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
export const remove = (ids) => {
  return request({
    url: '/api/blade-user/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/blade-user/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/blade-user/update',
    method: 'post',
    data: row
  })
}

export const grant = (userIds, roleIds) => {
  return request({
    url: '/api/blade-user/grant',
    method: 'post',
    params: {
      userIds,
      roleIds,
    }
  })
}

export const getUser = (id) => {
  return request({
    url: '/api/blade-user/detail',
    method: 'get',
    params: {
      id,
    }
  })
}

export const getUserInfo = () => {
  return request({
    url: '/api/blade-user/info',
    method: 'get',
  })
}

export const resetPassword = (userIds) => {
  return request({
    url: '/api/blade-user/reset-password',
    method: 'post',
    params: {
      userIds,
    }
  })
}

export const updatePassword = (oldPassword, newPassword, newPassword1) => {
  return request({
    url: '/api/blade-user/update-password',
    method: 'post',
    params: {
      oldPassword,
      newPassword,
      newPassword1,
    }
  })
}
export const setUpPassword = (newPassword, newPassword1) => {
  return request({
    url: '/api/blade-user/setUp-password',
    method: 'post',
    params: {
      newPassword,
      newPassword1,
    }
  })
}

export const promoteAdd = (form) => {

  return request({
    url: '/api/blade-user/promote/savepromote',
    method: 'post',
    data:form
  })
}

export const promoteRevise = (form) => {

  return request({
    url: '/api/blade-user/promote/revisepromote',
    method: 'post',
    data:form
  })
}

export const restPromote = (form) => {

  return request({
    url: '/api/blade-user/promote/restPromote',
    method: 'post',
    data:form
  })
}

export const getPromoteList = (current, size, params,level) => {
  return request({
    url: '/api/blade-user/promote/promotelist',
    method: 'get',
    params: {
      ...params,
      current,
      size,
      level,
    }
  })
}

export const getPromoteLeadList = (current, size, PromoteVO,level) => {
  return request({
    url: '/api/blade-user/promote/page',
    method: 'get',
    params: {
      ...PromoteVO,
      current,
      size,
      level,
    }
  })
}


export const getLeadList = (status,level) => {
  return request({
    url: '/api/blade-user/promote/lead',
    method: 'get',
    params: {
     status,
      level,
    }
  })
}

export const getpromoterList = (promoterDTO) => {
  return request({
    url: '/api/blade-user/promote/lead',
    method: 'get',
    params: {
      ...promoterDTO,
    }
  })
}
export const allInfo = () => {
  return request({
    url: '/api/blade-user/promote/allInfo',
    method: 'get',
    params: {
    }
  })
}
export const getLogo = () => {
  return request({
    url: '/api/blade-user/logo',
    method: 'get',
  })
}
export const getPromoter = (status,level) => {
  return request({
    url: '/api/blade-user/promote/promoter',
    method: 'get',
    params: {
      status,
      level
    }
  })
}
export const accountDetail = (current, size, account) => {
  return request({
    url: '/api/blade-details/account/accountDetail',
    method: 'get',
    params: {
      ...account,
      current,
      size,
    }
  })
}

export const resetAccountPassword = (id) => {
  return request({
    url: '/api/blade-details/account/resetPassword',
    method: 'post',
    params: {
      id
    }
  })
}
export const resetAccountPasswordPl = (accounts) => {
  return request({
    url: '/api/blade-details/account/resetAccountPasswordPl',
    method: 'post',
    params: {
      accounts
    }
  })
}
export const accountBan = (accountBanList) => {
  return request({
    url: '/api/blade-user/accountBan',
    method: 'post',
    data: accountBanList
  })
}
